public class sampleCont {
  public sampleCont(ApexPages.StandardController controller) {
    }
    public Boolean Type1tf = false;
    public Boolean Type2tf = false;
    public Boolean Type3tf = false;
    public Boolean Type4tf = false; 
    String[] countries = new String[]{};
                   
        public List<SelectOption> getItems() {
            List<SelectOption> options = new List<SelectOption>();
              options.add(new selectOption('Type1','Type1'));
              options.add(new selectOption('Type2','Type2'));
              options.add(new selectOption('Type3','Type3'));
              options.add(new selectOption('Type4','Type4'));
            return options;
        }            
          public String[] getCountries() {
            return countries;
          }
            
        public void setCountries(String[] countries) {
         this.countries = countries;
         System.debug('cos' +  countries);                 
       }
  
    public void setStype1(Boolean b) {
    this.Type1tf = b;
    }
    
    public Boolean getStype1() {
        return this.Type1tf;
    }    
         
    public void setStype2(Boolean b) {
     this.Type2tf = b;
    }
    public Boolean getStype2() {
        return this.Type2tf;
    }    
   public void setStype3(Boolean b) {
        this.Type3tf = b;
    }
   public Boolean getStype3() {
        return this.Type3tf;
    }    
   public void setStype4(Boolean b) {
        this.Type4tf = b;
    }
   public Boolean getStype4() {
        return this.Type4tf;
    }  
 
 public PageReference test() {

  if(Countries.Size() == 0){
              setStype2(false);
              setStype1(false);
              setStype4(False);
              setStype3(False);   
       } 
   else if(Countries.Size() == 1){
           if(Countries[0].contains('Type1')){
              setStype2(false);
              setStype1(true);
              setStype4(False);
              setStype3(False); 
             }
            else if(Countries[0].contains('Type2')){
              setStype1(false);
              setStype2(true);
              setStype4(False);
              setStype3(False); 
             }
            else if(Countries[0].contains('Type3')){
              setStype1(false);
              setStype3(true);
              setStype4(False);
              setStype2(False); 
             }
           else {
              setStype1(false);
              setStype4(true);
              setStype2(False);
              setStype3(False); 
             }
         }
      else if(Countries.Size() == 2){
            if(Countries[0].contains('Type1') && Countries[1].contains('Type2')){
              setStype2(true);
              setStype1(true);
              setStype4(False);
              setStype3(False); 
             }
              else if(Countries[0].contains('Type1') && Countries[1].contains('Type3')){
              setStype3(true);
              setStype1(true);
              setStype4(False);
              setStype2(False); 
             }
           else if(Countries[0].contains('Type1') && Countries[1].contains('Type4')){
              setStype4(true);
              setStype1(true);
              setStype3(False);
              setStype2(False); 
             }
           else if(Countries[0].contains('Type2') && Countries[1].contains('Type3')){
              setStype3(true);
              setStype2(true);
              setStype4(False);
              setStype1(False); 
             }
           else if(Countries[0].contains('Type2') && Countries[1].contains('Type4')){
              setStype4(true);
              setStype2(true);
              setStype3(False);
              setStype1(False); 
             } 
          else {
              setStype3(true);
              setStype4(true);
              setStype1(False);
              setStype2(False); 
             }
           }
else if(Countries.Size() == 3){
            if(Countries[0].contains('Type1') && Countries[1].contains('Type2') && Countries[2].contains('Type3')){
              setStype3(true);
              setStype2(true);
              setStype1(true);
              setStype4(False); 
             }
           else if(Countries[0].contains('Type1') && Countries[1].contains('Type2') && Countries[2].contains('Type4')){
              setStype2(true);
              setStype4(true);
              setStype1(true);
              setStype3(False); 
             }
           else if(Countries[0].contains('Type2') && Countries[1].contains('Type3') && Countries[2].contains('Type4')){
              setStype3(true);
              setStype4(true);
              setStype2(true);
              setStype1(False); 
             }
           else {
              setStype3(true);
              setStype4(true);
              setStype1(true);
              setStype2(False); 
             }
           }
   else {
        setStype3(true);
        setStype4(true);
        setStype1(true);
        setStype2(true);
       }
         return null;
      }   
    }